package com.quanyan.riding.web;

import com.github.ltsopensource.core.json.JSON;
import com.quanyan.api.APIResponse;
import com.quanyan.riding.service.RidingVoiceService;
import com.quanyan.riding.util.RunRidingEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author xian-guo
 * @email 498152332@qq.com
 * @date 2016/8/29.
 */
@RestController
@RequestMapping(value = "api/riding")
public class RidingVoiceController {

    private static final Logger LOGGER = LoggerFactory.getLogger(RidingVoiceController.class);

    /**
     * 语音服务
     */
    @Autowired
    private RidingVoiceService ridingVoiceService;

    /**
     * 查找城市所有的路书路径
     * @param paramMap
     * @return
     */
    @RequestMapping(value = "ridingVoiceMessage",method = RequestMethod.POST)
    public APIResponse getRidingVoiceMessage(@RequestBody(required = true) Map<String,Object> paramMap){
        LOGGER.debug("--------------->>>>"+JSON.toJSONString(paramMap));
        Integer pathId= (Integer) paramMap.get("pathId");
        if (null == pathId){
            return APIResponse.returnFail(RunRidingEnum.PARAMETER_NOT_ALLOW_NULL);
        }
        return ridingVoiceService.getRidingVoiceMessage(pathId);
    }

}
